<%@ include file="/taglibs.jsp" %>
<%@page import="org.istt.domain.User"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title><decorator:title default="Welcome"/> | <fmt:message key="webapp.name"/></title>
    <meta http-equiv="Cache-Control" content="no-store"/>
    <meta http-equiv="Pragma" content="no-cache"/>
    <meta http-equiv="Expires" content="0"/>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <link rel="shortcut icon" href="${ctx}/images/favicon.ico" type="image/x-icon"/>
    <script type="text/javascript" src="${ctx}/styles/menu/stlib.js"></script>
    
    <link rel="stylesheet" type="text/css" href="${ctx}/styles/deliciouslyblue/theme.css" title="default" />
    <link rel="alternate stylesheet" type="text/css" href="${ctx}/styles/deliciouslygreen/theme.css" title="green" />
    <link rel="stylesheet" type="text/css" href="${ctx}/styles/common.css"/>
    
	<script type="text/javascript" src="${ctx}/scripts/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/jquery.blockUI.js"></script>
    <script type="text/javascript" src="${ctx}/scripts/global.js"></script>
    <link href="${ctx}/styles/jquery.notify.dialog.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="${ctx}/scripts/jscal2/css/jscal2.css" />
    <link rel="stylesheet" type="text/css" href="${ctx}/scripts/jscal2/css/border-radius.css" />
    <script type="text/javascript" src="${ctx}/scripts/jscal2/js/jscal2.js"></script>
    <script type="text/javascript" src="${ctx}/scripts/jscal2/js/unicode-letter.js"></script>
    <script type="text/javascript" src="${ctx}/scripts/jscal2/js/lang/vi.js"></script>
    <script type="text/javascript" src="${ctx}/scripts/utils.js"></script>
    <script type="text/javascript" src="${ctx}/scripts/json2.js"></script>
    <script type="text/javascript">
 		// unblock when ajax activity stops 
    	$(document).ajaxStop($.unblockUI); 
 		var ajaxAnimation = '<img src="${ctx}/images/busy.gif" />...';
 		$(document).ready(function() {
 			  $.ajaxSetup({ cache: false });
 		});
    </script> 
    <script type="text/javascript">
<!--
<%User user=(User)request.getSession().getAttribute("USER_INFO");
String sessionuser = "";
if(user!=null) sessionuser = user.getId()+"";
%>

function getUrlVars() {
    var vars = {};
    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        vars[key] = value;
    });
    return vars;
}

function loadMessage(){
	var sessionValue = "<%=sessionuser%>";
	$.ajax({
	  url: 'checkingMessage.html',
	  data : {'currentUserId' : sessionValue},
	  dataType : 'json',
	  success: function(data) {
		if(data.message == 'msg' || data.message == 'file' || data.message == 'msgfile') {
			if(data.message == 'msg'){
				$("#notifymsg").html("B\u1EA1n c\u00F3 tin nh\u1EAFn m\u1EDBi!");
				$("#btnNotifyDialogViewMsg").show();
				$("#btnNotifyDialogViewFile").hide();
				
			}
			if(data.message == 'file'){
				$("#notifyfile").html("B\u1EA1n c\u00F3 h\u1ED3 s\u01A1 m\u1EDBi!");
				$("#btnNotifyDialogViewMsg").hide();
				$("#btnNotifyDialogViewFile").show();
			}
			if(data.message == 'msgfile'){
				$("#notifymsg").html("B\u1EA1n c\u00F3 tin nh\u1EAFn m\u1EDBi!");
				$("#notifyfile").html("B\u1EA1n c\u00F3 h\u1ED3 s\u01A1 m\u1EDBi!");
				$("#btnNotifyDialogViewMsg").show();
				$("#btnNotifyDialogViewFile").show();
			}
			ShowNotifyDialog(true);
			e.preventDefault();
		}
	  }
	});
}

$(document).ready(function (){
	//create a timer that will trigger the download messages every 1 minute
	setInterval("loadMessage();", 300000);
	
  $("#btnNotifyDialogClose").click(function (e)
  {
	  HideNotifyDialog();
     e.preventDefault();
  });
  $("#btnNotifyDialogCancel").click(function (e)
  {
	  HideNotifyDialog();
     e.preventDefault();
  });
  
  $("#btnNotifyDialogViewMsg").click(function (e){
	  		HideNotifyDialog();
	  		window.location = "${ctx}/messages.html?tab=2";
	         e.preventDefault();
	});
  $("#btnNotifyDialogViewFile").click(function (e){
		HideNotifyDialog();
		window.location = "${ctx}/tasks.html?tab=1";
       e.preventDefault();
	});

});


function ShowNotifyDialog(modal){
  $("#nofityoverlay").show();
  $("#notifydialog").fadeIn(300);

  if (modal)
  {
     $("#nofityoverlay").unbind("click");
  }
  else
  {
     $("#nofityoverlay").click(function (e)
     {
    	 HideNotifyDialog();
     });
  }
}

function HideNotifyDialog()
{
  $("#replyMessage").val("");
  $("#nofityoverlay").hide();
  $("#notifydialog").fadeOut(300);
}
//-->
</script>
    <decorator:head/>

</head>
<body>


<a name="top"></a>

<div id="page">

    <div id="header">
		        <table style="text-align:center; min-width: 250px; max-width: 20%;">
		        	<tr>
		        		<td>
		        			<div style="font-size:110%; color: white; font-weight: bold;text-shadow: 0.2em 0.2em 0.05em black">
					    		<fmt:message key="webapp.city"></fmt:message>
					    	</div>
		        		</td>
		        	</tr>
		        	<tr>
		        		<td>
		        			<div style="font-size:130%; color: white; font-weight: bold;text-shadow: 0.2em 0.2em 0.05em black">
					    		<fmt:message key="webapp.customer"></fmt:message>
					    	</div>
		        		</td>
		        	</tr>
		        </table>
    </div>
					
    <div id="content">
    <div id="sub">
    	
    	<script type="text/javascript" language="JavaScript1.2" src="${ctx}/loadmenu.html"></script>
    	<%@ include file="/decorators/calendar.jsp"%>
    </div>
		<div id="main">
            <h1><decorator:title/></h1>
            <%@ include file="/messages.jsp"%>
            <decorator:body/>

            <div id="underground"><decorator:getProperty property="page.underground"/></div>
        </div>	
        <div id="nav">
            <div class="wrapper">
                <h2 class="accessibility">Navigation</h2>
                <ul class="clearfix">
                    	<s:if test="#session.USER_INFO">
							<li style="float: right;">
								<a href="${ctx}/j_spring_security_logout" title="<fmt:message key="logout.title" />"><span>
									<img src="${ctx}/images/img_logout.png" height="20" width="20"></img>
								<fmt:message key="logout.title" /></span></a>
							</li>
						</s:if>
						<s:else>
							<li style="float: left: ;">
								<a href="${ctx}" title="<fmt:message key="login.title" />"><span>
									<img src="${ctx}/images/login.png" height="20" width="20"></img>
								<fmt:message key="login.title" /></span></a>
							</li>
						</s:else>
                		<s:if test="#session.USER_INFO">
	                		<li style="float: right;"><a href="${ctx}/updateUserInfo.html?id=${session.USER_INFO.id}" title="<fmt:message key="user.selfupdate.function" />"><span><img src="${ctx}/images/user_red.png" height="20" width="20"></img><s:property  value="#session.USER_INFO.fullname" /></span></a></li>
	    				</s:if>
						<%-- <s:else>
							<li><a href="${ctx}/index.html" title="<fmt:message key="login.title" />" id="Login"><span><img src="${ctx}/images/img_login.png" height="20" width="20"></img><fmt:message key="login.title" /></span></a></li>
						</s:else> --%>
						
	                	<s:if test="#session.USER_INFO">
	                		<li><a href="${ctx}/tasks.html?tab=1" title="<fmt:message key="tasklist" />"><span><img src="${ctx}/images/img_task.png" height="20" width="20"></img><fmt:message key="tasklist" /></span></a></li>
	                		<li><a href="${ctx}/file/histories.html" title="<fmt:message key="processingHistory.module.name" />"><span>
	                			<img src="${ctx}/images/done.png" height="20" width="20"></img>
	                			
	                			<fmt:message key="processingHistory.module.name" /></span></a></li>
	    				</s:if>
	                	<%-- <li><a href="#"><span><img src="${ctx}/images/help_contents.png" height="20" width="20"></img><fmt:message key="help" /></span></a></li> --%>
<%-- 	                	<s:if test="#session.USER_INFO">
	                		<li style="float: left; padding-top: 12px; font-size: 120%; font-weight: bold; padding-left: 12px;"><fmt:message key="general.message.welcome" /><s:property  value="#session.USER_INFO.fullname" /></li>
	    				</s:if> --%>
	    				<%-- <li style="float: left; padding-top: 12px; font-size: 120%">
	    					<jsp:useBean id="now" class="org.joda.time.DateTime"/>
	    					<joda:format value="${now}" locale="vi" style="F-"/>
	    				</li> --%>
	    				
                </ul>
            </div>
        </div><!-- end nav -->

    </div><!-- end content -->
	<br />
    <div id="footer">
        <p>
            <fmt:message key="index.footer"></fmt:message>
        </p>
    </div>
</div>

<!-- NOTIFICATION DIALOG -->
<div id="notifyoverlay" class="notify_dialog_overlay"></div>
<div id="notifydialog" class="notify_dialog">
   <table style="width: 100%; border: 0px;" cellpadding="3" cellspacing="0">
      <tr>
         <td class="notify_dialog_title"><img src="${ctx}/images/info_balloon.png" height="20" width="20" /><fmt:message key="tasklist.listExchange.dialog.label.notify"/></td>
         <td class="notify_dialog_title align_right">
            <a href="#" id="btnNotifyDialogClose"><img src="${ctx}/images/close.png" height="20" width="20" /></a>
         </td>
      </tr>
      <tr>
         <td  colspan="2"><img src="${ctx}/images/notify.png" height="60" width="60" /></td>
      </tr>
      <tr>
         <td id="notifymsg"></td>
         <td><button id="btnNotifyDialogViewMsg" type="button" class="button"> <fmt:message key="tasklist.listExchange.dialog.button.viewmsg"/> </button></td>
      </tr>
      <tr>
         <td id="notifyfile"></td>
         <td><button id="btnNotifyDialogViewFile" type="button" class="button"> <fmt:message key="tasklist.listExchange.dialog.button.viewfile"/> </button></td>
      </tr>
      <tr>
         <td colspan="2" style="text-align: center;">
         	<button id="btnNotifyDialogCancel" style="width:30px" type="button" class="button"> <fmt:message key="tasklist.listExchange.dialog.button.ok"/> </button>
         </td>
      </tr>
   </table>
</div>
</body>
</html>

